<table>
    <tr>
        <th class="kd1">快递方式选择<?= $this->formHidden('newAddressId', $this->newAddressId) ?></th>
        <th class="kd2">受理情况</th>
        <th class="kd3">按体积重量</th>
        <th class="kd4">结算重量</th>
        <th class="kd5">预计天数</th>
        <th class="kd6">金额(￥)</th>
    </tr>
    <?php
    $showItem = function($item, $view) {
        $accept = true;
        $message = '';
        foreach ($view->items as $si) {
            $itemAccept = $item->isAccept($si->ItemType);
            if ((!$itemAccept) && !strpos($message, $si->getItemTypeName())) {
                $message .= '不接受' . $si->getItemTypeName();
            }
            $accept = $accept && $itemAccept;
        }
        if($item->Express->MaxWeight > 0 && $view->SumWeight > $item->Express->MaxWeight){
            $accept = FALSE;
            $message .= ' 不接受大于'. ($item->Express->MaxWeight/1000) .'KG的包裹';
        }
        if($item->SortKey > 0){
        ?>
        <tr>
            <td class="kd1">
                <label>
                    <input data="<?= $item->Express->ReportFee ?>" type="radio" <?= $accept ? '' : ' disabled="disabled"' ?> class="shiptyperadio" value="<?= $item->ExpressId ?>" name="shipType" />
                    <span><?= $item->getExpress()->Name ?></span>
                    <?php if ($item->Express->Id == 37 && $view->isAbCoupon) { ?>
                        <br><font style="color: #c00;margin-left: 30px;">可用首重减免券</font>
                    <?php } ?>
                </label>
            </td>
            <td class="kd2"><?= $message ? "<span>$message</span>" : '可受理' ?></td>
            <td class="kd3"><?= $item->Express->IsVolume ? '<span class="shi">是</span>' : '<span class="fou">否</span>' ?></td>
            <td class="kd4"><?= $item->Express->IsVolume && $view->volumeWeight > $view->SumWeight ? ($view->volumeWeight) : ($view->SumWeight) ?>g</td>
            <?php $exinfo = Application_Model_Express::load($item->expressId);?>
            <td class="kd5"><?= $exinfo->es_time ?><input type="hidden" id="isRemoteFee" name="isRemoteFee" value="<?php echo $item->Express->IsRemoteFee; ?>" />工作日</td>
            <td class="kd6"><?= number_format($item->SortKey, 2) ?></td>
        </tr>
    <?php }}; ?>
    <?php
    foreach ($this->prices as $item) {
        $weight = 0;
        if($item->Express){
            if ($item->Express->IsVolume && ($this->volumeWeight > $this->SumWeight)){
                $weight = $this->volumeWeight;
    //            if($this->isWooden){
    //                $weight = $weight + $weight*0.05;
    //            }
            }else{
                $weight = $this->SumWeight;
    //            if($this->isWooden){
    //                $weight = $weight + 500;
    //            }
            }
            if ($this->isReceive) {
                $item->SortKey = "0.01";
            } else {
                $item->SortKey = $item->getMoneyByweight($weight);
            }
        }
    }
    $prices = Uuch_Util::quickSort($this->prices, 'SortKey');
    $air = NULL;
    foreach ($prices as $item) {
        if($item->Express){
            //被禁止
            if ($item->Express->isDisable == 1) {
                continue;
            }
            //东西马
            if ($this->isEast) {
                if ($item->ExpressId == Application_Model_Express::Express_WesternA || $item->ExpressId == Application_Model_Express::Express_WesternB) {
                    continue;
                }
            } else {
                if ($item->ExpressId == Application_Model_Express::Express_EastA || $item->ExpressId == Application_Model_Express::Express_EastB) {
                    continue;
                }
            }
            if ($this->isReceive) {
                if ($item->ExpressId == Application_Model_Express::Expredd_ReceiveUser) {
                    $showItem($item, $this);
                    continue;
                }
            } else {
                //跳过AIR，在最后面补上
                if ($item->Express->MaxWeight == 2000) {
                    continue;
                    ;
                }
                $showItem($item, $this);
            }
        }
    }
    foreach ($prices as $item) {
        if($item->Express){
            //被禁止
            if ($item->Express->isDisable == 1) {
                continue;
            }
            if ($item->Express->MaxWeight == 2000) {
                $showItem($item, $this);
            }
        }
    }
    ?>
</table>
<h4><i></i>温馨提示：选择中邮小包运送周期长、丢包率高、物流跟踪不畅，如急用或贵重物品请慎重选择！</h4>
<?= $this->formHidden('isEuro2', $this->city->isEuro()) ?>
<?= $this->formHidden('isZipRemoteFee2', $this->isZipRemoteFee) ?>